<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>呼叫系统</title>
    <link rel="icon" type="image/png" href="${pageContext.request.contextPath}/static/images/logotab.png">
    <%@include file="../common/common-base.jsp"%>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/styles/common/jquery-accordion-menu.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/styles/common/common-index.css">
    <%-- <link rel="icon" href="${pageContext.request.contextPath}/favicon.ico" type="image/x-icon" />
     <link rel="shortcut icon" href="${pageContext.request.contextPath}/favicon.ico" type="image/x-icon" />--%>
    <script type="text/javascript" src="${pageContext.request.contextPath}/scripts/common/plugins/encryptionAlgorithm.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/scripts/common/plugins/jquery-accordion-menu.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/scripts/common/plugins/vue-2.3.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/hg/hg.ui.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/hg/hg.util.js"></script>
    <!-- 引入socketjs -->
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/ws/sockjs.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/ws/stomp.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/ws/reconnecting-websocket.js"></script>
    <!--覆盖样式-->
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/index-over.css">
    <style>
        .msg_a:hover {
            /*font: 12px blue;*/
            text-decoration: underline;
        }
        /*.msg_a a:hover {*/
        /*background-color: #7747ab;;*/
        /*}*/
        .msg_t{
            bottom: 100px;
            border-radius :4px;
        }
    </style>
</head>

<body>
<!-- 消息提示声音-->
<audio src="${pageContext.request.contextPath}/static/sound/voice.mp3" style='display:none' id='audio'></audio>
<!--菜单模板-->
<script type="text/x-template" id="leftmenu">
    <li @click="select()" v-bind:id="id">
        <a href="#"><i class="iconfont" :class="iconClass"></i>{{model.text}} </a>
        <ul class="submenu" v-if="model.children">
            <leftmenu v-for="child in model.children" v-bind:model="child" ></leftmenu>
        </ul>
    </li>
</script>

<script type="text/x-template" id="treeboxmenu">

    <li :id="data.id" :class="{'check':data.children==null}">
        <a v-if="data.children==null">
            <input type="checkbox" :id="'box'+data.id" v-model="data.checked" :value="data.id" @change="checked(data)"/>
            <label :for="'box'+data.id">{{data.text}}</label>
        </a>

        <a :id="'floor'+data.id" @click="toggleMenu()" class="list-title" v-if="data.children!=null">
            <i class="iconfont" :class="{'uce-plus':!open,'uce-minus':open}"></i>
            {{data.text}}
        </a>
        <ul :class="'floor'+data.id" class="submenu" v-if="data.children!=null && open==true">
            <treeboxmenu v-for="item in data.children" :data="item" :opentype="false"></treeboxmenu>
        </ul>

    </li>
</script>
<!--菜单模板-->

<div id="vueScope" :class="settings.themes" v-cloak>
    <!--header-->
    <div v-if="decodeURI(user.userInfo.topRoleCode) ==  'cccs' || decodeURI(user.userInfo.topRoleCode) ==  'cccsl'">
        <header class="header">
            <div  class="left" >
                <img alt="logo" src="${applicationScope.STATIC_SERVERADDRESS}/images/uc56_logo.png" style="width:126px;height:70px;line-height:70px;padding: 0 0 0 10px;">
                <div class="title">
                    ${applicationScope.SYSTEM_NAME}
                </div>
            </div>
            <div style="float:right;height:70px;margin-top:2px;width:1100px;margin-right:100px;overflow: hidden;">
                <jsp:include page="/WEB-INF/pages/callcenter/phonebar.jsp"/>
            </div>
            <div class="right">
                <!-- 如果有加按钮，需要手动调整 padding  -->
                <%--<a id="userdtl"><i class="iconfont uce-people"></i><span id="empName">{{decodeURI(user.userInfo.empName)}}</span><!-- <i class="iconfont uce-triangledown"></i> --></a>|--%>
                <%--<a @click="$('#department').dialog('open')"><i class="iconfont uce-qiehuan"></i><span id="orgName">{{decodeURI(user.userInfo.orgName)}}</span></a>|--%>
                <!--<a id="message"><i class="iconfont uce-remind-circle"></i><span class="span-tip">99</span><span>消息</span></a>| -->
                <a @click="openPwdlg()"><i class="iconfont uce-password" title="密码修改"></i><span></span></a>|
                <a @click="openSetting($event)" id="setting" title="设置"><i class="iconfont uce-set"></i><span></span></a>|
                <a @click="logout()" title="退出"><i class="iconfont uce-exit"></i><span></span></a>
            </div>
        </header>
    </div>
    <div v-if="decodeURI(user.userInfo.topRoleCode) ==  '000000' ">
        <header class="header">
            <div  class="left">
                <img alt="logo" src="${applicationScope.STATIC_SERVERADDRESS}/images/uc56_logo.png" style="width:126px;height:46px;padding: 0 0 0 10px;">
                <div class="title">
                    ${applicationScope.SYSTEM_NAME}
                </div>
            </div>
            <div class="right">
                <!-- 如果有加按钮，需要手动调整 padding  -->
                <a id="userdtl"><i class="iconfont uce-people"></i><span id="empName">{{decodeURI(user.userInfo.empName)}}</span><!-- <i class="iconfont uce-triangledown"></i> --></a>|
                <a @click="$('#department').dialog('open')"><i class="iconfont uce-qiehuan"></i><span id="orgName">{{decodeURI(user.userInfo.orgName)}}</span></a>|
                <!--<a id="message"><i class="iconfont uce-remind-circle"></i><span class="span-tip">99</span><span>消息</span></a>| -->
                <a @click="openPwdlg()"><i class="iconfont uce-password"></i><span>密码修改</span></a>|
                <a v-if="user.permissionCode.indexOf('msg_authority') != -1" @click="openMsgdlg()"><i class="iconfont uce-set"></i><span>消息提醒设置</span></a>
                <b v-if="user.permissionCode.indexOf('msg_authority') != -1">|</b>
                <a @click="openUnReadMsgdlg()" id="totalMsgSetting"><i class="iconfont uce-mail"></i><span>未读消息</span></a>|
                <a @click="openSetting($event)" id="setting"><i class="iconfont uce-set"></i><span>设置</span></a>|
                <a @click="logout()" ><i class="iconfont uce-exit"></i><span>退出</span></a>
            </div>
        </header>
    </div>

    <article class="uce-layout" >
        <div id="content" class="easyui-layout" style="width:100%;height:100%;">
            <!--菜单-->
            <div id="caidan" data-options="region:'west',split:true,border:true" style="width:210px;background:#ebeff3">
                <div id="vuedom">
                    <div class="jquery-accordion-menu red" style="min-width:100%;width:100%;" v-cloak>
                        <ul id="demo-list">
                            <li id="homepage" class="" @click="openTab('首页','${pageContext.request.contextPath}/home.do',false,0,portal_global_systemCode,false)">
                                <a href="#"><i class="iconfont uce-home"></i>首页</a>
                                <i class="iconfont uce-turnleft menu-switch"></i>
                            </li>
                            <li>
                                <a href="#" @click="toggleRapidMenus()"><i class="iconfont uce-collect"></i>常用菜单</a>
                                <i class="iconfont uce-liebiao menu-switch" @click="$('#shortcutMenu').dialog({modal:true}).dialog('open');"></i>
                                <ul class="submenu" id="bbs">
                                    <li v-if="fastMenu.length==0" @click="$('#shortcutMenu').dialog({modal:true}).dialog('open');"><button class="add-menu"><i class="iconfont uce-add"></i>添加菜单</button></li>
                                    <li v-for="item in fastMenu" @click="openTab(item.text,item.attributes,true,item.id,item.systemCode,false)"><a href="#"><i class="iconfont uce-thirdfile"></i>{{item.text}}</a></li>
                                </ul>
                            </li>
                        </ul>
                    </div>
                    <div id="jquery-accordion-menu" class="jquery-accordion-menu red" style="min-width:100%;width:100%;" v-cloak>
                        <ul id="demo-list">
                            <leftmenu v-for="item in leftMenu" :model="item"></leftmenu>
                        </ul>
                    </div>
                </div>

            </div>
            <!--主体内容-->
            <div data-options="region:'center',border:false" style="width:100%!important;">
                <div id="mainTab" class="easyui-tabs" fit="true"></div>
            </div>
        </div>
    </article>

    <!--用户信息-->
    <!-- <div class="userdtl" style="display:none;">
        <div id="triangle-facing-left" class="triangle-facing-left" ></div>
        <div class="user-content">
            <ul>
                <li>
                    <i class="iconfont uce-status"></i>
                    <span>{{user.userInfo.position}}</span>
                </li>
                <li>
                    <i class="iconfont uce-watch"></i>
                    <span id="loginTime">{{formatTime(user.userInfo.lastLoginTime)}}</span>
                </li>
            </ul>
        </div>
    </div> -->

    <!--消息列表-->
    <!--<div class="messages msg-p" style="display:none;">
        <div id="triangle-facing-left" class="triangle-facing-left" ></div>
        <div class="message-content">
            <ul>
                <li v-for="tip in message.msgs" @click="openMessage(tip)">
                    <i class="read-tip" v-bind:class="{'read-tip-off':tip.state==true}"></i>
                    <div>
                        <span>{{tip.title}}</span>
                        <span>{{tip.time}}</span>
                    </div>
                </li>
            </ul>
        </div>
        <div class="more-info">查看全部消息</div>
    </div>-->
    <!--消息详情model-->
    <!--<div id="messageDetail" class="easyui-dialog" data-options="closed:true,title:'消息详情'"
    style=" width:500px;height:300px;padding:5px 15px;display:none;" v-cloak>
        <div class="msgdtl">{{message.msgdetl.content}}</div>
    </div>-->

    <!--切换部门model-->
    <div id="department" class="easyui-dialog" data-options="closed:true,title:'请选择部门'"
         style=" width:200px;height:300px;padding:5px 15px;display:none;" v-cloak>
        <div class="menu-dlg-left" style="border:none;">
            <ul style="padding:0;">
                <li v-for="(item, index) in user.userInfo.orgRefRel">
                    <input type="radio" :id="'org'+index" :value="item.orgId" v-model="user.choseOrg">
                    <label :for="'org'+index" >{{item.orgName}}</label>
                </li>
            </ul>
            <button class="changeOrg" @click="changeOrg()">确定</button>
        </div>
    </div>

    <!--功能设置-->
    <div class="setting">
        <!--<button @click="openSetting($event)" class="iconfont uce-set setting-btn"></button>-->
        <div class="setting-themes">
            <span class="themes-title"><i class="iconfont uce-themes" style="font-size:24px"></i></span>
            <ul>
                <li class="themes-choice default" @click="settingThemes('default',$event)">
                    <i v-if="settings.themes == 'default'" class="iconfont uce-success-circle"></i>
                </li>
                <li class="themes-choice blue" @click="settingThemes('blue',$event)">
                    <i v-if="settings.themes == 'blue'" class="iconfont uce-success-circle"></i>
                </li>
                <li class="themes-choice black" @click="settingThemes('black',$event)">
                    <i v-if="settings.themes == 'black'" class="iconfont uce-success-circle"></i>
                </li>
            </ul>
        </div>
    </div>

    <!--快捷菜单设置-->

    <div id="shortcutMenu" class="easyui-dialog" data-options="closed:true,title:'常用菜单设置',constrain:true"
         style=" width:700px;height:500px;padding:5px 15px;display:none;" buttons="#saveBtn" v-cloak>
        <div class="flex-style menu-dlg">
            <div class="treeboxmenu">

                <ul class="xza-menulist" style="border:none;">
                    <treeboxmenu v-for="item in rapidMenus.lefts" :data="item" ></treeboxmenu>
                </ul>

            </div>
            <div class="menu-dlg-center">
                <div>
                    <span @click="getAddRemove('allin')">全部移入<i class="iconfont uce-turnright"></i></span>
                    <span @click="getAddRemove('in')">移入<i class="iconfont uce-turnright"></i></span>
                    <span @click="getAddRemove('out')"><i class="iconfont uce-turnleft"></i>移出</span>
                    <span @click="getAddRemove('allout')"><i class="iconfont uce-turnleft"></i>全部移出</span>
                    <!--<span @click="saveMenu()" class="success"><i class="iconfont uce-success-circle"></i>保存</span>-->
                </div>
            </div>
            <div class="menu-dlg-right">
                <div class="selected">快捷菜单</div>
                <ul>
                    <li v-for="(item, index) in rapidMenus.rights">
                        <input type="checkbox" :id="'K'+index" :value="item.id" v-model="rapidMenus.rightChecked">
                        <label :for="'K'+index" >{{item.text}}</label>
                        <span class="iconfont uce-upstairs move" :id="'up'+item.id" @click="sortMenu('up',item.id)"></span>
                        <span class="iconfont uce-downstairs move" :id="'down'+item.id" @click="sortMenu('down',item.id)"></span>
                    </li>
                </ul>
                <div class="selected"><input type="checkbox" id="checkAll" v-model="rapidMenus.rightAllChecked"/><label>已选: {{ rapidMenus.rightChecked.length }}/{{rapidMenus.rights.length}}</label></div>
            </div>
        </div>
    </div>
    <div id="saveBtn" style="text-align:center;display:none">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="iconfont uce-success-circle"  @click="saveMenu()" style="width:90px">保存</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="iconfont uce-cancel" onclick="javascript:closeDialog('shortcutMenu')" style="width:90px">取消</a>
    </div>

</div>

<!--右键菜单-->
<div id="mm" class="easyui-menu" style="width:120px;display:none;">
    <div data-options="iconCls:'iconfont uce-cancel'" id="closecur">
        关闭
    </div>
    <div data-options="iconCls:'iconfont uce-cancel'" id="closeall">
        关闭全部
    </div>
    <div  data-options="iconCls:'iconfont uce-cancel'"id="closeother">
        关闭其他
    </div>
    <div class="menu-sep"></div>
    <div data-options="iconCls:'iconfont uce-cancel'" id="closeleft">
        关闭左侧标签
    </div>
    <div data-options="iconCls:'iconfont uce-cancel'" id="closeright">
        关闭右侧标签
    </div>
</div>
<!--右键菜单-->
<!--修改密码-->
<div id="dlgUpdatePwd" class="easyui-dialog" style="width:380px;height:280px; padding:10px 20px;display:none;" closed="true"  buttons="#divUpdatePwdBtn">
    <form id="formUpdatePwd" method="post" >
        <table class="table" style="width: 100%; border:0px;">
            <tbody>
            <tr style="padding-left: 20px">
                <td width="30%">旧密码:</td>
                <td width="70%">
                    <input id="oldPassword"  class="easyui-passwordbox" required="true" iconWidth="24" style="width:100%;height:40px" data-options="prompt:'请输入原密码..'">
                    <input id="oldPasswordHidden" name="oldPassword" type="hidden">
                </td>
            </tr>
            <tr>
                <td>新密码:</td>
                <td>
                    <!-- 2017-12-18 修改密码强度校验规则 -->
                    <input id="newPassword" class="easyui-passwordbox" required="true" iconWidth="24" style="width:100%;height:40px" data-options="prompt:'请输入新密码..',validType:['consecutiveRepeatCharacterRegex','consecutiveCharacterRegex','passwordRule']">
                    <input id="newPasswordHidden" name="newPassword" type="hidden">
                    <!-- 2017-12-18 修改密码强度校验规则 -->
                </td>
            </tr>
            <tr>
                <td>确认密码:</td>
                <td>
                    <input class="easyui-passwordbox" required="true" iconWidth="24" style="width:100%;height:40px" data-options="prompt:'请再次输入新密码..'" validType="equals['#newPassword']">
                </td>
            </tr>
            </tbody>
        </table>
        <input id="passwordStrength" name="passwordStrength" type="hidden" value="STRONG"/>
    </form>
</div>
<div id="divUpdatePwdBtn" style="display:none;">
    <a href="javascript:void(0)" class="easyui-linkbutton save" onclick="vm.savePassword()" style="width:90px">保存</a>
    <a href="javascript:void(0)" class="easyui-linkbutton call" onclick="javascript:closeDialog('dlgUpdatePwd')" style="width:90px">取消</a>
</div>
<!--修改消息提醒-->
<div id="dlgUpdateMsg" class="easyui-dialog" style="width:380px;height:280px; padding:10px 20px;display:none;" closed="true"  buttons="#divUpdateMsgBtn">
    <!-- datagrid -->
    <%--<table id="dgProblemOrder" class="easyui-datagrid" data-options="fit:true"></table>--%>
    <table id="dataGridMsg" style="width: 100%; border:0px;" class="easyui-datagrid" data-options="fit:true"></table>
</div>
<div id="divUpdateMsgBtn" style="display:none;">
    <a href="javascript:void(0)" class="easyui-linkbutton save" onclick="vm.saveMsg()" style="width:90px">保存</a>
    <a href="javascript:void(0)" class="easyui-linkbutton call" onclick="javascript:closeDialog('dlgUpdateMsg')" style="width:90px">取消</a>
</div>

<div id="totalDialog" class="msg_t" title="消息统计" data-options="iconCls:'icon-tip',closed:true,resizable:false" style="display:none">
    <table id="totalDataGridMsg" style="width: 100%; border:0px;" class="easyui-datagrid" data-options="fit:true" ></table>
</div>
<%--<div style="width: 100%;height: 10%;border: 2px solid saddlebrown;">
		<input type="text" name="empCode" id="empCode"  />请输入empCode
		<input type="text" name="messageText" id="messageText"  />请输入内容
		<input type="button" value="sendBtn" onclick="sendMessage()" />
	</div>--%>
<style>
    .m-div{
        width: 300px;
        margin: 5px auto;
    }
    .call{
        margin-left: 30px;
    }
</style>
<%--登录框--%>
<div id="dlg" class="easyui-dialog" title="座机登录" data-options="iconCls:'icon-save',modal:true,closed:true" style="width:400px;height:250px;padding:10px">
    <div class="m-div">
        <input id="usercode" class="easyui-textbox" width="300px" label="工号：" name="questionType" labelAlign="left" data-options="width:300,editable:false"/>
    </div>
    <div class="m-div">
        <input id="phonenum"  class="easyui-textbox"  width="300px" label="分机号：" name="questionType" labelAlign="left" data-options="prompt:'请输入',width:300,validType:'length[1,10]'"/>
    </div>
    <%--<div class="m-div"></div>--%>
    <div id="divUserBtn" style="text-align: center;margin-top: 30px">
        <a href="javascript:void(0)" class="easyui-linkbutton  save" onclick="saveUser()" >保存</a>
        <%--<a href="javascript:void(0)" class="easyui-linkbutton call" onclick="javascript:closeDialog('dlg')">取消</a>--%>
    </div>
</div>
<%--班长打开面板--%>
<div id="ws" closed="true" class="easyui-window" title="窗口" data-options="iconCls:'icon-save',modal:true" style="width:600px;height:500px;padding:5px;">
    <div class="easyui-layout" data-options="fit:true">
        <%--<div style="height: 500px;overflow-x: hidden;overflow-y: scroll" class="content">--%>
        <div data-options="region:'center'" style="padding:10px;">
            <div class="easyui-accordion" id="bzaccordion" style="width:550px;">

            </div>
            <%--</div>--%>
        </div>
        <div data-options="region:'south',border:false" style="text-align:right;padding:5px 0 0;">
            <a class="easyui-linkbutton qxjt" style="display:none" href="javascript:void(0)" onclick="qxjt()" style="width:80px">取消监听</a>
            <a class="easyui-linkbutton jt"  href="javascript:void(0)" onclick="jtFun()" style="width:80px">监听</a>
            <a class="easyui-linkbutton"  href="javascript:void(0)" onclick="ljFun()" style="width:80px">拦截</a>
            <a class="easyui-linkbutton"  href="javascript:void(0)" onclick="javascript:$('#ws').window('close')" style="width:80px">取消</a>
        </div>
    </div>
</div>
<style>
    td[field="checkbox"]{
        position: relative;
        z-index: 100;
    }
    input[type="checkbox"]{
        position: relative;
        z-index: -1;
    }
    .accordion .accordion-header {
        background: #E0ECFF;
        filter: none;
    }
    .panel-title{
        color: #0E2D5F;
    }
</style>
<script type="text/javascript">
    var empCode;
    var updPwdFlag="${sessionScope.updPwdFlag}";
    var updPwdIntervalDay="${sessionScope.updPwdIntervalDay}";
    document.title = "${applicationScope.SYSTEM_NAME}";
    var domain = window.location.protocol + "//" + window.location.host;
    $(function () {
        $("#phonenum").next("span").find(".textbox-text").attr("maxlength",10);
//        $("body").on("click",".datagrid-cell-check input",function () {
//            $(this).parent(".datagrid-cell-check").trigger("click");
//
//            setTimeout(function () {
//                var isCheck=$(this).is(':checked');
//                var tt = $(this)
//                if(isCheck){
//                    $(this).attr("checked", false);
//                }else{
//                    $(this).attr("checked", true);
//                }
//            },0)
//
//            return false;
//        })
    })
    //    选择要监听或者拦击的对象
    var userData={}
    function closeUserDia() {
        closeDialog('dlg')
    }
    //    监听
    function jtFun() {
        var num = userData.userDeiceNum;
        var tnum = $("#phonenum").textbox("getValue");
//        frmPhone.window.agentListen(num,tnum)
//        return;
        if(!num){
            $.messager.alert('提示','请选择要操作的分机！');
            return
        }
        if(userData.status == "ResourceAtWork"){
            frmPhone.window.agentListen(num,tnum);
            uceLoading.show('loading',null, 5000);
        }else{
            $.messager.alert('提示','只能监听通话中的分机！');
        }


    }
    //监听成功回调
    function jtsucc() {
        uceLoading.close();
        $(".jt").hide();
        $(".qxjt").show();
    }
    //取消监听成功回调
    function qxsucc() {
        uceLoading.close();
        $(".jt").show();
        $(".qxjt").hide();
    }
    function closeLoad(){
        uceLoading.close();
    }

    //    拦截
    function ljFun() {
        uceLoading.show('loading',null, 5000);
        var num = userData.userDeiceNum;
        if(!num){
            $.messager.alert('提示','请选择要操作的分机！');
            return
        }
//        var tnum = $("#phonenum").textbox("getValue")
        frmPhone.window._sstCall(num)
    }
    function qxjt() {
        var num = userData.userDeiceNum;
        uceLoading.show('loading',null, 2000);
        frmPhone.window.cleaMap();
        debugger;
        frmPhone.window._hangupCall();

    }
    //    渲染用户列表
    function datagridFun(data,index) {
        console.log(data,index);
        var data=data;
        var arr=[];
        //解决数据出empty异常
        for(var i=0;i<data.length;i++){
            console.log(data[i]);
            if(data[i]){
                arr.push(data[i]);
                console.log(data[i])
            }
        }
        $("#tt"+index).datagrid({
            data:arr,
            checkOnSelect:true,
            selectOnCheck:true,
            singleSelect:true,
            onSelect:function (index,row) {
                console.log(index,row);
//                userData=row;
            },
            onClickRow: function (rowIndex, row) {
                console.log(index,row);
                var check = $(this).datagrid("getSelected");
//                解决单选还要取消选择变态怪异需求
                if(row.userDeiceNum == userData.userDeiceNum){
                    $(this).datagrid("clearChecked");
                    userData={};
                }else{
                    userData=row;
                }
            },
            onLoadSuccess: function (data) {
                try{
                    $(this).parent().find("div .datagrid-header-check").children("input[type=\"checkbox\"]").eq(0).attr("style", "display:none;");
                }catch (e){
                    console.log(e)
                }

            },
            columns :[ [
                {
                    field : 'checkbox',
                    title : '选择',
                    checkbox:true,
                    width : 50,
                    align : 'center'
                },
                {field:'status',title:'状态',align:'center',width:50,formatter:function(value,row,index){

                        var html=""
                        if(value == "ResourceAtWork"){
                            html="<span style='display: inline-block;width: 15px;height: 15px;background: green;border-radius: 50%'></span>"
                        }else {
                            html="<span style='display: inline-block;width: 15px;height: 15px;background: pink;border-radius: 50%'></span>"

                        }
//                        "<input type='checkbox' />"
                        return html;
                    },
                },{
                    field : 'userCode',
                    title : '坐席工号',
                    width : 80,
                    align : 'center'
                }, {
                    field : 'userName',
                    title : '坐席姓名',
                    width : 100,
                    align : 'center'
                }, {
                    field : 'userStatus',
                    title : '坐席状态',
                    width : 90,
                    align : 'center'
                } ,{
                    field : 'userDeiceNum',
                    title : '分机号',
                    width : 90,
                    align : 'center'
                }] ]
        })
    }
    //    openBzDialog([])
    function openBzDialog(list) {
//        var html=frmPhone.window.getGroups();
        console.log(list);
//        $('#bzaccordion').html("");
//        console.log($("#bzaccordion").accordion('panels'))
        if(!list){
            return;
        }
        if(list.length!=0){
            if($("#bzaccordion").accordion('panels').length ===0){
                var list =list;
                for(var i=0;i< list.length;i++){
                    $('#bzaccordion').accordion('add',{
                        title:list[i].skillName.replace(/skillname./,""),
                        content:'<table id="tt'+i+'"></table>'
                    });
                }

                $("#bzaccordion").accordion({
                    onSelect:function (title,index) {
                        console.log(title,index);
                        userData={}
                        frmPhone.window.getGroupByUser(index,list[index].skillId)
                    },
                    onUnselect:function (title,index) {
                        console.log( $("#tt"+index).datagrid)
                        try {
                            $("#tt"+index).datagrid("clearChecked")
                        }catch (e){
                            console.log("cccccc")
                        }

                    }
                });
                $("#bzaccordion").accordion('getSelected').panel('collapse')
            }
            $('#ws').window('open');
        }else{
            $.messager.alert('提示','没有查询到分组数据！');
        }


    }
    //    登录
    function saveUser() {
//        获取工号
        var agtId = frmPhone.window.phone.agtId;
//        获取座机号
        var phonenum = $("#phonenum").textbox("getValue");
        frmPhone.window.loginCTI(agtId, phonenum);
    }
    console.log(frmPhone)
    //var permissionCode="";//权限 -用于iframe调用
    //关闭消息窗口
    var closeMessage = function(){
        $(".messages").slideUp();
        $(".userdtl").hide();
    }

    //vue树层级节点全局模板
    Vue.component('leftmenu', {
        props: ['model'],
        template: '#leftmenu',
        computed: {
            id: function () {
                return this.model.id
            },
            title: function () {
                return this.model.text
            },
            systemCode: function(){
                return this.model.systemCode
            },
            href : function () {
                return this.model.attributes;
            },
            iconClass: function(){
                if(this.model.children!=null){
                    if(this.model.permissionIcon != null && this.model.permissionIcon.replace(/(^\s*)|(\s*$)/g, "") != ""){
                        return this.model.permissionIcon;
                    }else{
                        return 'uce-file';
                    }
                }else{
                    return 'uce-thirdfiles';
                }
            }

        },
        methods: {
            select: function(){
                //console.log(vm.tretabs)
                if(this.model.children!=null){
                    return;
                }
                vm.openTab(this.title,this.href,true,this.id,this.systemCode,false)
            }
        }
    });

    /*带CheckBox菜单*/
    Vue.component('treeboxmenu', {
        props: {
            data:{
                type:Array,
                required: true,
                default:[]
            },
            opentype:{
                type:Boolean,
                default:true
            },
            style:{
                type:Object,
                required:false,
                default:{}
            }
        },
        template: '#treeboxmenu',
        data:function(){
            return {
                selected:[],
                selectDatas:[]
            }
        },
        computed: {
            id: function () {
                return this.model.id
            },
            title: function () {
                return this.model.text
            },
            open:function(){
                return this.opentype
                //计算属性依赖于原始属性，想修改计算属性可修改原始属性或者通过计算属性的set方法赋值
            }
        },
        methods: {
            checked: function(item){
                this.$root.getChecked(item);//直接触发父节点函数
                //this.$emit('myselffn',item);//组件嵌套2次以上无法将事件传递至最外层

            },
            toggleMenu:function(){
                this.opentype = !this.opentype;
            }
        },
        watch:{}
    })



    //消息列表
    /* var messages = [
     {"title":"东方时代防水方式方式单身的1","time":"2017-05-06","state":true,"content":"contentcontentcontentcontentcontent"},
     {"title":"东方时代防水方式方式单身的2","time":"2017-05-06","state":false,"content":"contentcontentcontentcontentcontent"},
     {"title":"东方时代防水方式方式单身的3","time":"2017-05-06","state":true,"content":"contentcontentcontentcontentcontent"},
     {"title":"东方时代防水方式方式单身的4","time":"2017-05-06","state":false,"content":"contentcontentcontentcontentcontent"},
     ] */

    var settings = localStorage.settings;
    var oldUserMenu = [];
    var oldArrayCheck =[];
    //实例化vue
    var vm = new Vue({
        el: "#vueScope",
        data: {
            user:{
                userInfo:{
                    orgRefRel: {},
                    roleCodeList:[],
                    topRoleCode:"000000"
                },//用户信息
                permissionCode:[],
                choseOrg: [] //选择的部门
            },
            baseData:[],//全局基础数据
            fastMenu:[],//用于展示快捷菜单
            leftMenu:[],//左侧菜单数据
            codeRefMenu:{},
            tabIndexRefTitle:{},
            /*message:{
             "msgs":messages,//消息集合
             "msgdetl":{}//单条消息详情
             },*/
            tretabs:{},//打开的tabs
            onThisMenuid:null,//当前menuid
            settings:settings?JSON.parse(settings):{
                type:false,
                themes:"default"
            },
            checked:[],
            rapidMenus:{//常用菜单设置
                "type":false,
                "leftChecked":[],//左侧已选择项id集合
                "rightChecked":[],//右侧已选择项id集合
                "leftAllChecked":false,//左侧全选状态
                "rightAllChecked":false,//右侧全选状态
                "lefts":[],//左侧数据
                "rights":[],//右侧数据
                "keyWord":""//搜索关键词
            }
        },
        mounted:function(){//#el挂在后执行
            var vueThis = this;

            vueThis.getMenus();
            vueThis.getUser();

            //tab切换
            $('#mainTab').tabs({
                onSelect:function(title,index){
                    $("#demo-list li.active").removeClass("active")
                    $(".jquery-accordion-menu .submenu a").css("background-color",'')
                    $(".jquery-accordion-menu a").css("background-color",'')
                    if(vm.tretabs[title]){
                        if(vm.tretabs[title]!='0'){
                            $("#"+vm.tretabs[title])[0].childNodes[0].style.background = "rgba(200, 200, 200, 0.50)";
                        }else if(vm.tretabs[title] === '0'){
                            //$("#homepage").addClass("active");
                        }
                        vueThis.onThisMenuid = vueThis.tretabs[title];

                        /**判断选中标题所对应面板是否存在列表（以class：needRefreshOnSelectTab进行定位）
                         * 如果存在，刷新此列表
                         */
                        var iframeid = "indextab"+portal_global_systemCode+title;
                        console.log($('#'+iframeid).contents().find('.needRefreshOnSelectTab').length);
                        if($('#'+iframeid).contents().find('.needRefreshOnSelectTab').length > 0){
                            $('#'+iframeid).contents().find('.search-form .search').trigger('click');//触发查询按钮的点击事件
                        }
                        //获取焦点
                        $('#'+iframeid).contents().find('.search-form .search').focus();
                    }
                    if(title == '数据导出查看'){
                        var iframeid = "indextab"+portal_global_systemCode+title;
                        $('#'+iframeid).contents().find('.search').trigger('click');                    }
                },
                onAdd:function(title,index){
                    var id = $(this).tabs('getTab',index).attr('id');
                    vueThis.tabIndexRefTitle[id]=title;
                },
                onBeforeClose:function(title,index){
                    var id = $(this).tabs('getTab',index).attr('id');
                    delete vueThis.tabIndexRefTitle[id];
                    delete vueThis.tretabs[title];
                }
            });
            //tab右键菜单
            tabRightMenu('mainTab','mm');

            //折叠菜单
            $(".uce-turnleft.menu-switch").click(function(event){
                var e =event||window.event;
                e.stopPropagation();
                $('#content').layout('collapse','west');

                setTimeout(function(){
                    $('#mainTab').tabs('getSelected').resize();
                },1000);
            });

            $("body").click(function(event){
                if(vueThis.settings.type){
                    $(".setting").removeClass('active');
                    vueThis.settings.type = !vueThis.settings.type;
                    localStorage.setItem("settings",JSON.stringify(vueThis.settings));
                }
            });
        },
        updated:function(){//视图更新后执行
            var vueThis = this;

            /*
             //折叠消息窗口
             $('#message').click(function(event){
             var e =event||window.event;
             $(".messages").slideDown(500);
             $(".userdtl").hide();
             $(document).one("click", function () {
             $(".messages").hide();
             });
             //$(".messages").click(function (event) {
             //event.stopPropagation();
             //});
             e.stopPropagation();
             })
             //用户信息
             $("#userdtl").mouseenter(function(event){
             var offsetLeft = $("#userdtl").offset().left - $("#userdtl")[0].offsetWidth/2 + 15;
             var e =event||window.event;
             $(".userdtl").css({"left":offsetLeft})
             $(".userdtl").slideDown(500);
             $(".messages").hide();
             $(".userdtl").mouseleave(function(event){
             var e =event||window.event;
             $(".userdtl").hide();
             e.stopPropagation();
             })
             $(document).one("click", function () {
             $(".userdtl").hide();
             });
             e.stopPropagation();
             })*/
        },
        computed:{
            //计算属性
        },
        methods: {
            getUser:function(){
                var vueThis = this;
                //异步加载当前用户信息
                $.ajax({
                    url:'${pageContext.request.contextPath}/login/getCurrentUser.do',
                    data:{},
                    success:function(result){
                        vueThis.user.userInfo = result;
                        empCode=vueThis.user.userInfo.empCode;
                        vueThis.user.userInfo.position = "开发工程师";
                        if(result.roleCodeList.indexOf('cccsl')>=0){
                            vueThis.user.userInfo.topRoleCode = 'cccsl';
                        }else if(result.roleCodeList.indexOf('cccs')>=0){
                            vueThis.user.userInfo.topRoleCode = 'cccs';
                        }else{
                            vueThis.user.userInfo.topRoleCode = "000000";
                        }

                    }
                })
                //异步加载权限码
                $.ajax({
                    url:'${pageContext.request.contextPath}/login/findPermissionCodeByCurrentUser.do',
                    data:{},
                    success:function(result){
                        vueThis.user.permissionCode=result;
                    }
                })
            },
            getMenus:function(){
                var vueThis = this;
                $.ajax({
                    url:'${pageContext.request.contextPath}/login/getMenuTree.do',
                    data:{},
                    async:true,
                    success:function(result){
                        var idNodeRef = {};
                        var menuData = [];
                        if(result != null){
                            result.map(function(item){
                                idNodeRef[item.id] = item;
                                vueThis.codeRefMenu[item.permissionCode] = item;
                            })
                            result.map(function(item){
                                if(item.parentId != null && idNodeRef[item.parentId] != null){
                                    if(idNodeRef[item.parentId].children == null ){
                                        idNodeRef[item.parentId].children = [];
                                    }
                                    idNodeRef[item.parentId].children.push(item);
                                }else{
                                    menuData.push(item);
                                }
                            })
                        }

                        vueThis.leftMenu = menuData;
                        vueThis.baseData = JSON.parse(JSON.stringify(vueThis.leftMenu));
                        setTimeout(function(){
                            $("#jquery-accordion-menu").jqueryAccordionMenu();
                        },500)

                        vueThis.getUserMenus();
                    }
                })
            },
            getUserMenus:function(){
                var vueThis = this;
                var menudatasLeft = [];
                var menudatasRight = [];
                $.ajax({
                    url:'${pageContext.request.contextPath}/menu/getUserMenu.do',
                    data:{},
                    async:true,
                    success:function(result){
                        oldUserMenu = result;
                        //数组指向同一Array对象，将导致数据异常
                        var newArrays = JSON.parse(JSON.stringify(vueThis.baseData));
                        function eachArray(Arrays,key){
                            for (var i = 0; i < Arrays.length; i++) {
                                if(Arrays[i].children==null){
                                    if(Arrays[i].id == key){
                                        menudatasRight.push(Arrays[i]);
                                        Arrays.splice(i,1)
                                    }
                                }else{
                                    eachArray(Arrays[i].children,key)
                                }
                                menudatasLeft = Arrays;
                            }
                        }
                        if(result.length>0){
                            for(var i =0;i<result.length;i++){
                                var key = result[i];
                                eachArray(newArrays.slice(0),key)
                            }

                            vueThis.rapidMenus.lefts = menudatasLeft;
                            vueThis.rapidMenus.rights = menudatasRight;
                        }else{
                            vueThis.rapidMenus.lefts = newArrays;
                            vueThis.rapidMenus.rights = [];
                        }
                        vueThis.fastMenu = menudatasRight.slice();
                    }
                })
            },
            getChecked:function(item){
                var val = item.id;
                if(item.checked){
                    if(this.checked.length>0){
                        if(this.checked.indexOf(val) == -1){
                            this.checked.push(val);
                        }

                    }else{
                        this.checked.push(val);
                    }
                }else{
                    if(this.checked.length>0){
                        if(this.checked.indexOf(val) != -1){
                            this.checked.splice(this.checked.indexOf(val),1);
                        }

                    }
                }
            },
            getAddRemove: function(way) {
                var vueThis = this;
                var addIn = vueThis.checked;
                var cancelOut = vueThis.rapidMenus.rightChecked;
                /*所有的末级菜单集合*/
                var allChildList = [];
                function eachArray(Arrays){
                    for (var i = 0; i < Arrays.length; i++) {
                        if(Arrays[i].children==null){
                            allChildList.push(Arrays[i])
                        }else{
                            eachArray(Arrays[i].children)
                        }
                    }
                }
                //根据基础数据筛选
                eachArray(vueThis.baseData);
                /*所有的末级菜单集合*/

                if(way =='in'){
                    if(addIn.length === 0 ){
                        return;
                    }

                    for(var i=0;i<addIn.length;i++){
                        var id = addIn[i];

                        allChildList.forEach(function(item,index){
                            if(item.id == id){
                                if(vueThis.rapidMenus.rights.indexOf(item) == -1){
                                    vueThis.rapidMenus.rights.push(item);
                                }
                            }
                        })
                    }

                }else if(way =='out'){
                    if(cancelOut.length === 0){
                        return;
                    }
                    for(var i=0;i<cancelOut.length;i++){
                        var id = cancelOut[i];
                        for(var j in vueThis.rapidMenus.rights){
                            if(vueThis.rapidMenus.rights[j].id === id){
                                vueThis.rapidMenus.rights.splice(j,1);
                            }
                        }
                        vueThis.checked.forEach(function(item,index){
                            if(item == id){
                                vueThis.checked.splice(index,1)
                            }
                        })
                    }
                }else if(way == 'allin'){
                    vueThis.rapidMenus.rights = allChildList.slice(0);
                }else{
                    vueThis.rapidMenus.rights = [];
                }

                vueThis.checked = [];
                vueThis.rapidMenus.rightChecked = [];
                //过滤
                vueThis.setLefts();
                /*if(this.rapidMenus.keyWord!=""){
                 this.filterMenu(this.rapidMenus.keyWord);
                 }*/
            },
            filterMenu:function(filterKey){
                this.rapidMenus.keyWord = filterKey;
                this.rapidMenus.leftChecked = [];

                //根据输入框内容检索列表
                var searchRegex = new RegExp(JSON.parse(filterKey), 'i');
                var arr =[];
                var list = this.rapidMenus.lefts;
                for(var i=0,len=list.length;i<len;i++){
                    if(searchRegex.test(list[i].text)){
                        arr.push(list[i])
                    }
                }
                this.rapidMenus.lefts = arr;
            },
            setLefts:function(){
                //该方法为比较左右数据重复，筛选出左边剩余数据
                var vueThis  = this;
                var rights = vueThis.rapidMenus.rights;
                var menudatasLeft = [];
                var newArrays = JSON.parse(JSON.stringify(vueThis.baseData));
                function eachArray(Arrays,key){
                    for (var i = 0; i < Arrays.length; i++) {
                        if(Arrays[i].children==null){
                            if(Arrays[i].id == key){
                                Arrays.splice(i,1);
                            }
                        }else{
                            eachArray(Arrays[i].children,key)
                        }
                        menudatasLeft = Arrays;
                    }
                }
                if(rights.length>0){
                    for(var i =0;i<rights.length;i++){
                        var id = rights[i].id;
                        eachArray(newArrays,id)
                    }
                    vueThis.rapidMenus.lefts = menudatasLeft;
                }else{
                    vueThis.rapidMenus.lefts = newArrays;
                }

            },
            sortMenu:function(type,id){
                var vueThis = this;
                var sortArray = JSON.parse(JSON.stringify(this.rapidMenus.rights));
                var moveid = id;
                try{
                    sortArray.forEach(function(item,index){
                        if(item.id == moveid){
                            if(type == 'up'){
                                if(index==0)return;
                                sortArray.splice(index,1);
                                sortArray.splice(index-1,0,item);
                            }else{
                                if(index==(sortArray.length-1))return;
                                sortArray.splice(index,1);
                                sortArray.splice(index+1,0,item);
                            }
                            vueThis.rapidMenus.rights = sortArray;
                            //vueThis.fastMenu = sortArray;
                            foreach.break=new Error("StopIteration");
                        }
                    })
                }catch(e){
                    if(e.message==="foreach is not defined") {
                        return;
                    }else throw e;
                }
            },
            saveMenu:function(){
                var vueThis = this;
                var rightInfo = vueThis.rapidMenus.rights.slice(0);
                var ids = [];
                for (var i = 0; i < rightInfo.length; i++) {
                    ids.push(rightInfo[i].id);
                }
                $.ajax({
                    url:'${pageContext.request.contextPath}/menu/saveUserMenu.do?',
                    data :{'ids': ids.join(','),'empCode':this.user.userInfo.empCode,'cmsBaseOrgCode':this.user.userInfo.cmsBaseOrgCode,'oldUserMenu':oldUserMenu.join(',')},
                    success :function(data) {
                        $('#shortcutMenu').dialog('close');
                        vueThis.fastMenu = rightInfo;
                    }
                });
            },
            openTab: function(title,href,closable,permissionId,systemCode,/**是否刷新*/refresh){
                var treeid = systemCode + title;//构造iframe的ID
                var localObj = window.location;
                var contextPath = localObj.pathname.split("/")[1];
                var basePath = localObj.protocol+"//"+localObj.host+"/"+contextPath;
                var basePath2 = "${pageContext.request.contextPath}";
                if(href != null){
                    if(href.indexOf("sysurl") == 0){
                        href = href.replace(/sysurl/,basePath);
                    }else if(href.indexOf(basePath) == 0){
                    }
                    else{
                        href = basePath2 + href;
                    }
                };
                //打开tab页
                var tabTitle = vm.tabIndexRefTitle['idtab'+treeid];
                //var e = $('#mainTab').tabs('exists',title);
                if(tabTitle){
                    //$("#mainTab").tabs('select',title);
                    if(title != tabTitle){
                        $("#mainTab").tabs('update',{
                            tab : $("#mainTab").tabs('getTab',tabTitle),
                            options: {
                                title:title
                            }
                        })
                        vm.tabIndexRefTitle['idtab'+treeid] = title;
                        delete vm.tretabs[tabTitle];
                        vm.tretabs[title] = permissionId;
                    }
                    $("#mainTab").tabs('select',title);
                    var tab = $("#mainTab").tabs('getSelected');
                    if(refresh != false){
                        document.getElementById('indextab' + treeid).src = href;
                    }
                }else{
                    if($('#mainTab').tabs('tabs').length >= 10){
                        showTips("最多只能打开10个标签页！","warning",3000);
                        return false;
                    }
                    //这个判断可能打开的页面不是这个用户的菜单
                    if(permissionId){
                        vm.tretabs[title] = permissionId;
                    }

                    /* $('#mainTab').tabs('add',{
                     title:title,
                     content:'<iframe src="'+href+'" id="indextab'+treeid+'" scrolling="auto" frameborder="0" style="width:100%;height:100%"></iframe>',
                     closable:closable
                     }); */
                    //add by xj crossDomain
                    //判断是否跨域
                    if(href.indexOf(domain) == 0){
                        //没跨域直接打开
                        var iframe = '<iframe src="' + href + '" id="indextab' + treeid + '" scrolling="auto" frameborder="0" style="width:100%;height:100%"></iframe>';
                        $('#mainTab').tabs('add', {
                            id: 'idtab'+treeid,
                            title: title,
                            content: iframe,
                            closable: closable
                        });
                    } else {
                        //跨域实现跳转
                        var state = 1;
                        var iframe = '<iframe src="${pageContext.request.contextPath}/login/crossDomain.do" id="indextab' + treeid + '" scrolling="auto" frameborder="0" style="width:100%;height:100%"></iframe>';
                        $('#mainTab').tabs('add', {
                            id: 'idtab'+treeid,
                            title: title,
                            content: iframe,
                            closable: closable
                        });

                        var crossDomainParams = {
                            currentUser: this.user.userInfo,
                            permissionCode: this.user.permissionCode
                        };
                        document.getElementById('indextab' + treeid).addEventListener("load",
                            function() {
                                if(state == 1) {
                                    state = 0;
                                    document.getElementById('indextab' + treeid).src = href;
                                    document.getElementById('indextab' + treeid).contentWindow.name = JSON.stringify(crossDomainParams);
                                }
                            }, true);
                    }
                    //add by xj crossDomain
                }
            },

            openwuliguijiTab (title,href,closable,permissionId,systemCode,/**是否刷新*/refresh){
                debugger;
                var treeid = systemCode + title;//构造iframe的ID
                var localObj = window.location;
                var contextPath = localObj.pathname.split("/")[1];
                var basePath = localObj.protocol+"//"+localObj.host+"/"+contextPath;
                var basePath2 = "${pageContext.request.contextPath}";
                // if(href != null){
                //     if(href.indexOf("sysurl") == 0){
                //         href = href.replace(/sysurl/,basePath);
                //     }else if(href.indexOf(basePath) == 0){
                //     }
                //     else{
                //         href = basePath2 + href;
                //     }
                // };
                //打开tab页
                var tabTitle = vm.tabIndexRefTitle['idtab'+treeid];
                // //var e = $('#mainTab').tabs('exists',title);
                if(tabTitle){
                    //$("#mainTab").tabs('select',title);
                    if(title != tabTitle){
                        $("#mainTab").tabs('update',{
                            tab : $("#mainTab").tabs('getTab',tabTitle),
                            options: {
                                title:title
                            }
                        })
                        vm.tabIndexRefTitle['idtab'+treeid] = title;
                        delete vm.tretabs[tabTitle];
                        vm.tretabs[title] = permissionId;
                    }
                    $("#mainTab").tabs('select',title);
                    var tab = $("#mainTab").tabs('getSelected');
                    if(refresh != false){
                        document.getElementById('indextab' + treeid).src = href;
                    }
                }else{
                    if($('#mainTab').tabs('tabs').length >= 10){
                        showTips("最多只能打开10个标签页！","warning",3000);
                        return false;
                    }
                    //这个判断可能打开的页面不是这个用户的菜单
                    if(permissionId){
                        vm.tretabs[title] = permissionId;
                    }

                    /* $('#mainTab').tabs('add',{
                     title:title,
                     content:'<iframe src="'+href+'" id="indextab'+treeid+'" scrolling="auto" frameborder="0" style="width:100%;height:100%"></iframe>',
                     closable:closable
                     }); */
                    //add by xj crossDomain
                    //判断是否跨域
                    if(href.indexOf(domain) == 0){
                        //没跨域直接打开
                        var iframe = '<iframe src="' + href + '" id="indextab' + treeid + '" scrolling="auto" frameborder="0" style="width:100%;height:100%"></iframe>';
                        $('#mainTab').tabs('add', {
                            id: 'idtab'+treeid,
                            title: title,
                            content: iframe,
                            closable: closable
                        });
                    } else {
                        //跨域实现跳转
                        var state = 1;
                        var iframe = '<iframe src="${pageContext.request.contextPath}/login/crossDomain.do" id="indextab' + treeid + '" scrolling="auto" frameborder="0" style="width:100%;height:100%"></iframe>';
                        $('#mainTab').tabs('add', {
                            id: 'idtab'+treeid,
                            title: title,
                            content: iframe,
                            closable: closable
                        });

                        var crossDomainParams = {
                            currentUser: this.user.userInfo,
                            permissionCode: this.user.permissionCode
                        };
                        document.getElementById('indextab' + treeid).addEventListener("load",
                            function() {
                                if(state == 1) {
                                    state = 0;
                                    document.getElementById('indextab' + treeid).src = href;
                                    document.getElementById('indextab' + treeid).contentWindow.name = JSON.stringify(crossDomainParams);
                                }
                            }, true);
                    }
                    //add by xj crossDomain
                }
            },


            closeCurrentTab: function(){
                var tab = $("#mainTab").tabs('getSelected');
                var index = $("#mainTab").tabs("getTabIndex", tab);
                $("#mainTab").tabs("close", index);
            },
            beforeCloseCurrentTab:function(fn){
                var tab = $("#mainTab").tabs('getSelected');
                var index = $("#mainTab").tabs("getTabIndex", tab);
                if(fn)
                    fn();
                $("#mainTab").tabs("close", index);

            },
            closeTabforName: function(name){
                //根据名称关闭tab页 Sunny_20190731
                $("#mainTab").tabs("close", name);
            },
            openTabFromIFrame : function(permissionCode,params,attr){
                var menuItem = this.codeRefMenu[permissionCode];
                var urlParams = '';
                if(params){
                    for(key in params){
                        urlParams += key+'='+params[key] + '&';
                    }
                }
                if( menuItem != null){
                    this.openTab(attr && attr.title ? attr.title : menuItem.text,menuItem.attributes +'?' + urlParams,true,menuItem.id,attr.systemCode,attr && attr.refresh ? attr.refresh : undefined);
                }else{//自定义url
                    if(attr && attr.url)
                        this.openTab(attr.title,attr.url +'?' + urlParams,true,null,attr.systemCode,attr && attr.refresh ? attr.refresh : undefined);
                }
            },
            changeOrg:function(type){
                $('#department').dialog('close');
                $.ajax({
                    url:'${pageContext.request.contextPath}/login/changeOrg.do',
                    data:{orgId:this.user.choseOrg,operateFlag:'CHANGE_ORG'},
                    dataType:'TEXT',
                    success: function(result){
                        window.location.href="${pageContext.request.contextPath}/login/loginIndex.do";
                    }
                })
            },
            openMessage:function(news){
                //打开消息详情
                this.message.msgdetl = news;
                $('#messageDetail').dialog('options').title = news.title;
                $('#messageDetail').dialog({modal:true}).dialog('open');
            },
            openSetting:function(event){
                //折叠设置窗口
                var e = event || window.event;
                e.stopPropagation()
                //$(".setting").toggle(!this.settings.type);
                if(this.settings.type){
                    $(".setting").removeClass('active');
                }else{
                    $(".setting").addClass('active');
                }
                this.settings.type = !this.settings.type;
                localStorage.setItem("settings",JSON.stringify(this.settings));
            },
            settingThemes:function(val,event){
                var e = event || window.event;
                e.stopPropagation();
                //皮肤设置
                this.settings.themes = val;
                for (var i=0; i<frames.length; i++){
                    frames[i].postMessage({fn:'settingThemes',params:{theme:val}},'*');
                    /* var cssStyleDom = frames[i].frameElement.contentDocument.getElementById('themes-setting');
                     if(cssStyleDom == null){
                     var css = document.createElement('style');
                     css.type='text/css';
                     css.id="themes-setting";
                     if(val=='default'){
                     css.innerHTML =".iconfont{color:#ff9372;}";
                     }else if(val =='blue'){
                     css.innerHTML =".iconfont{color:#23b7e5;}";
                     }else{
                     css.innerHTML =".iconfont{color:#464c5b;}";
                     }
                     frames[i].frameElement.contentDocument.head.appendChild(css);
                     }else{
                     if(val=='default'){
                     cssStyleDom.innerHTML =".iconfont{color:#ff9372;}";
                     }else if(val =='blue'){
                     cssStyleDom.innerHTML =".iconfont{color:#23b7e5;}";
                     }else{
                     cssStyleDom.innerHTML =".iconfont{color:#464c5b;}";
                     }
                     } */
                }
            },
            toggleRapidMenus:function(){
                //折叠常用菜单
                $("#bbs").toggle(!this.rapidMenus.type);
                this.rapidMenus.type =!this.rapidMenus.type;
            },
            //显示弹窗
            openMsgdlg:function(){
                var columns = [[
                    {field: 'id',title: '选择',width : 150, checkbox: true},
                    {field: 'woTypeName', title: '提醒工单类型11', align: 'center',width : 280,formatter: function(value,row,index){
                            return row.woTypeName + '-' +row.woDealTypeName;
                        }}
                ]];
                var dataGridParams = {
                    //获取数据
                    url: G_CTX_PATH + '/cs/CsMsg/findMsgConfig.do',
                    queryParams:{ },
                    singleSelect : 'false',
                    fitColumns : 'false',
                    rownumbers: 'false',
                    striped: false,
                    pagination:false,
                    onLoadSuccess:function(data){
                        //首先默认全选
                        var rowData = data.rows;
                        $.each(rowData,function(idx,val){//遍历JSON
                            if(val.isChecked == 1){
                                $("#dataGridMsg").datagrid("selectRow", idx);//如果数据行为已选中则选中改行
                            }
                        });
                    }
                }
                openDialog("dlgUpdateMsg","设置消息提醒");
                newloadGrid('dataGridMsg', columns, dataGridParams);
            },
            saveMsg:function(){
                //获取选中行
                var checkedrows = [];
                var rows = $("#dataGridMsg").datagrid("getSelections");
                if(rows.length <= 0){
                    showInfoMsg("请选择您要设置的数据");
                    return;
                }else{
                    $.each(rows, function(index, item){
                        checkedrows.push(item.id);
                    });
                    checkedrows =checkedrows.join(",");
                }
                var data={
                    checkedrows:checkedrows
                }
                confirmMsg("您确认要保存吗?", function(){
                    uceAjax(G_CTX_PATH+"/cs/CsMsg/updateMsgConfig.do",data,function (result) {
                        if(result.success) {
                            showInfoTip("保存成功","",1000);
                            closeDialog('dlgUpdateMsg');
                        }
                    },"POST");
                });
            },
            openPwdlg:function(){
                $("#formUpdatePwd").form('clear');
                $("#dlgUpdatePwd").dialog({
                    onBeforeClose:function(){
                        if(updPwdFlag == "true"){
                            showErrorMsg('请修改密码，密码由数字和字母构成，且不能少于8位！');
                            return false;
                        }
                    }
                })
                openDialog("dlgUpdatePwd","修改密码");
            },
            savePassword:function(){
                $("#newPasswordHidden").val(hex_md5($("#newPassword").val()));
                $("#oldPasswordHidden").val(hex_md5($("#oldPassword").val()));
                $('#formUpdatePwd').form('submit',{
                    url : '${pageContext.request.contextPath}/login/updatePwd.do',
                    onSubmit : function() {
                        if($(this).form('validate')){
                            return true;
                        }
                        return false;
                    },
                    task : function(result) {
                        updPwdFlag="false";
                        closeDialog("dlgUpdatePwd");
                        if (result.success == false) {
                            showErrorMsg(data.message);
                        } else {
                            showInfoMsg('密码修改成功,将跳转到登陆界面重新登陆！',function(){
                                //跳转到登陆界面重新登陆
                                window.location.href='${pageContext.request.contextPath}/login/logout.do';
                            });
                        }
                    }
                });
            },
            logout:function(){
                window.location.href="${pageContext.request.contextPath}/login/logout.do";
            },
            openDlg:function(userCode){
                //设置工号
                $("#usercode").textbox("setValue",userCode)
                $("#dlg").dialog("open");
            }
        },
        directives:{
            keyup(el,binding){
                el.oninput = function(){
                    //非常关键的赋值
                    binding.value.setLefts();

                    //删除左右空格
                    var trimVal = el.value.replace(/(^\s*)|(\s*$)/g, "");
                    var filterKey = JSON.stringify(trimVal);
                    binding.value.filterMenu(filterKey);

                }
            }
        },
        watch:{
            'settings':function(newvalue,oldvalue){
                var settings = JSON.stringify(newvalue);
                localStorage.setItem("settings",settings);
            },
            'settings.themes':function(newvalue,oldvalue){
                //皮肤设置
                var settings = JSON.stringify(this.settings);
                localStorage.setItem("settings",settings);
            },
            'rapidMenus.leftAllChecked':function(newvalue,oldvalue){
                if(newvalue==true){
                    //全选
                    var left = this.rapidMenus.lefts
                    this.rapidMenus.leftChecked = [];
                    for(var i=0;i<left.length;i++){
                        this.rapidMenus.leftChecked.push(left[i].id);
                    }
                }else{
                    //全选状态 ==> 全不选
                    if(this.rapidMenus.leftChecked.length == this.rapidMenus.lefts.length){
                        this.rapidMenus.leftChecked =[];
                    }else{
                        //全选状态 ==> 部分选择
                    }
                }
            },
            'rapidMenus.rightAllChecked':function(newvalue,oldvalue){
                if(newvalue==true){
                    //全选
                    var right = this.rapidMenus.rights;
                    this.rapidMenus.rightChecked =[];
                    for(var i=0;i<right.length;i++){
                        this.rapidMenus.rightChecked.push(right[i].id);
                    }
                }else{
                    //全选状态 ==> 全不选
                    if(this.rapidMenus.rightChecked.length == this.rapidMenus.rights.length){
                        this.rapidMenus.rightChecked =[];
                    }else{
                        //全选状态 ==> 部分选择
                    }
                }
            },
            'rapidMenus.leftChecked':function(newvalue,oldvalue){
                //console.log(newvalue)
                if(newvalue.length ==0 || newvalue.length < this.rapidMenus.lefts.length){
                    this.rapidMenus.leftAllChecked = false;
                }else{
                    this.rapidMenus.leftAllChecked = true;
                }
            },
            'rapidMenus.rightChecked':function(newvalue,oldvalue){
                //console.log(newvalue)
                if(newvalue.length ==0 || newvalue.length < this.rapidMenus.rights.length){
                    this.rapidMenus.rightAllChecked = false;
                }else{
                    this.rapidMenus.rightAllChecked = true;
                }
            }
        }
    })
    $(function(){
        //初始化打开首页
        vm.openTab("首页",'/home.do',false,0,portal_global_systemCode,false);
        if(updPwdFlag == "true"){
            if (updPwdIntervalDay == 0) {
                showInfoMsg("用户首次登录请修改密码!", function () {
                    vm.openPwdlg();
                });
            } else if (updPwdIntervalDay > 0) {
                showInfoMsg("您的密码已过期,请修改密码", function () {
                    vm.openPwdlg();
                });
            }
        }

        /**
         * 监听跨域iframe传递的消息
         */
        window.addEventListener('message', function(e) {
            var msg = e.data;
            switch(msg.fn) {
                case 'click':
                    if(vm.settings.type){
                        vm.openSetting();
                    }
                    break;
                case 'openTab':
                    this.vm.openTabFromIFrame(msg.permissionCode,msg.params,msg.attr);
                    break;
                default:
                    break;
            }

        })

        $("#phonenum").textbox('textbox').bind("keyup",function(e){
            // 兼容FF和IE和Opera
            var theEvent = e || window.event;
            var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
            if (code == 13) {
                //回车执行查询
                saveUser();
            }
        });
    })

    /* *
     * @Author: chenqinglong
     * @Description: 来电弹屏
     * @Date: 2018/5/24 21:33
     * @Param:
     * @return:
     */
    function callerScreenProjectileWindow(callId, subId, area, ani, grpId, srcAgt, ivrList) {
        //var phone = ani;
        //var phone = "13402222987";
        /*
         * @Author:chutianhua
         * @update:
         * @Date:2018/6/28
         *
         * */
        //判断当前手机号是否未定义
        if(ani==undefined){
            ani = "";
        }
        openTabCrossDomainIcsSimple("home_screenPopup","来电弹屏",'/home_screenPopup/'+ani+'.do',true,0,portal_global_systemCode,true);
//			var callerScreenWindow = new HgUi.windowIframe({
//				id: 'callerScreenWindow',
//				width: 1200,
//				height: 550,
//				title: "来电弹屏",
//				url: '/home_screenPopup/'+ani+'.do',
//				modal:false
//			});
    }
    /* 来电弹屏
     * @Author:zhaocan
     * @update:2018-07-10
     * @description :UI更换，页面重写
     * */
    function callScreenPopUp(callId, callType, waybillNo, ani, grpId, srcAgt, ivrList) {
        //var phone = ani;
        //var phone = "13402222987";

        //判断当前手机号是否未定义
        if(ani==undefined){
            ani = "";
        }
        if(callType ==1 ){
            openTabCrossDomainCcSimple("callScreenPopUp","来电弹屏"+ani,'/callScreenPopUp/'+ani+'/'+waybillNo+ '.do',true,0,portal_global_systemCode,true);
        }else if(callType == 2){
            openTabCrossDomainCcSimple("ccosCallScreenPopUp","来电弹屏"+ani,'/ccosCallScreenPopUp/'+ani+'/'+waybillNo+'.do',true,0,portal_global_systemCode,true);
        }else{
            openTabCrossDomainCcSimple("callScreenPopUp","来电弹屏"+ani,'/callScreenPopUp/'+ani+'/'+waybillNo+ '.do',true,0,portal_global_systemCode,true);
        }
    }

    /**
     * 关闭来电弹屏
     * **/
    function closeModuleWin(){
        $('#callerScreenWindow').window('close');
    }
</script>

<script type="text/javascript">
    var url = G_CTX_PATH+"/dictData/findByTypesCodes.do";
    initDictDatas("MSG_INTERVAL,MSG_TOTAL,MSG_OPEN,MSG_SING_TIMEOUT",{url:url});
    var msgTotal="MSG_TOTAL";
    var msgInterval="MSG_INTERVAL";
    var msgOpen="MSG_OPEN";
    var typeCode="1";
    var showTip=null;
    var msgOpenDict= getTypeNameByCode(msgOpen,typeCode,showTip);
    var msgSingTimeout = getTypeNameByCode("MSG_SING_TIMEOUT",typeCode,showTip);
    if(msgOpenDict=="1"){
        var msgTotalDict=getTypeNameByCode(msgTotal,typeCode,showTip);
        var msgIntervalDict= getTypeNameByCode(msgInterval,typeCode,showTip);
        console.info("新消息提醒");
        //setInterval(showMsgInterval,msgIntervalDict);
    }

    var columns = [[
        {field: 'woTypeName_DealTypeName', title: '<div style="font-size:10px;font-weight:bold;margin-top:0;color:#7747ab;">工单类型</div>', align: 'center',width:140,formatter: function(value,row,index){
                var url =row.woTabUrl;
                var msgId='all';
                return '<a href="javascript:linkToTab(\''
                    + row.woTabName
                    + '\',\''
                    + msgId
                    + '\',\''
                    + url
                    + '\',\''
                    + row.woTypeName
                    + '\',\''
                    + row.woCode
                    + '\')">'+row.woTypeName+'-'+formatWoDealTypeName(row.woDealType)+'</a>';
            }},
        {field: 'count', title: '<div style="font-size:10px;font-weight:bold;margin-top:0;color:#7747ab;">未读总数</div>', align: 'center',width:90}
    ]];

    var dataGridParams = {
        //获取数据
        url: '/ics-remind/cs/CsTaskMsg/findCountCurrentMsg.do',
        queryParams:{ },
        singleSelect : 'false',
        fitColumns : 'false',
        rownumbers: 'false',
        striped: false,
        pagination:false,
        onBeforeLoad:function(param){
            return false;
        }
    }
    newloadGrid('totalDataGridMsg', columns, dataGridParams);

    /**
     * 单条消息提醒
     * */
    function showMsgSingle(e){
        var json = {};
        uceAjax( '/ics-remind/cs/CsTaskMsg/findCurrentMsg.do',json,function (result) {
            if(result.success && result.data) {
                var val = result.data;
                //弹窗没有消失跳过处理
                if($("#msg_"+val.woCode).length > 0){
                    return false;
                }
                showTaskMsg(val);
            }
        });

    }

    function formatWoDealTypeName(woDealType){
        if(!woDealType){
            return "待认领";
        }else{
            return "待办";
        }
    }

    /**
     * 查询工单类型名称
     * */
    function showTaskMsg(val){
        var msgId = "msg_"+val.woCode + "_" + val.taskId;
        var url =val.woTabUrl;
        var orderChilTypeName="";
        if(val.orderChilTypeName){
            orderChilTypeName = val.orderChilTypeName;
        }
        var msg = '<a href="javascript:linkToTab(\''
            + val.woTabName
            + '\',\''
            + msgId
            + '\',\''
            + url
            + '\',\''
            + val.woDealType
            + '\',\''
            + val.woCode
            + '\')">'+val.woTypeName+'-'+formatWoDealTypeName(val.woDealType)+'' +
            '收到一条"' + val.woTypeName.split("-")[0]+ '"' + formatWoDealTypeName(val.woDealType) + '提醒' +
            '</br>' +
            '工单编号:' + val.woCode +
            "</br>" +
            orderChilTypeName +
            '</a>';
        showMag(msg,msgId);
    }

    function websocket(){
        var url = G_CTX_PATH+"/dictData/findByTypesCodes.do";
        initDictDatas("WEBSOCKET",{url:url});
        var typeClassCodes="WEBSOCKET";
        var typeCode="1";
        var showTip=null;
        var dict=getTypeNameByCode(typeClassCodes,typeCode,showTip);
        if(dict=="1"){
            console.log("websocket开关打开！");
            var ws =
                $(function(){
                    ws = new ReconnectingWebSocket("ws://"+window.location.host+"/ics/websocket.do");
                    ws.onopen = function () {
                        console.log("websocket onopen!");
                    }
                    ws.onclose = function () {
                        console.log("websocket onclose!");
                    }
                    ws.onmessage = function (msg) {
                        showMag(msg.data);
                    }
                });
        }else{
            console.log("websocket开关关闭！");
        }
    }

    /**
     * 新消息提醒
     * */
    function showMsgInterval(){
        uceAjax('/ics-remind/cs/CsTaskMsg/findCountCurrentMsg.do',{},function (result) {
            if(result.success) {
                if(result.total >0 ){
                    //消息总数
                    showMsgGrid(result);
                }else{
                    //没有数据清空grid
                    showMsgGrid({"total":0,rows:[]});
                    $('#totalDialog').window('close');
                }
            }
        },"POST");
        //唤起单条提醒
        showMsgSingle();
    }

    function linkToTab(tabName,msgId,tabUrl,woDealType,woCode,e){
        if(msgId != "" && 'all' != msgId){
            //当前消息标记为已经读取
            var woCodeTaskId = msgId.split("_")[1] +"_"+ msgId.split("_")[2];
            var msgId = "msg_"+woCode;
            openTabCrossDomainIcsSimple("message_notice",tabName,tabUrl+'?woMsgCode='+woCode,true,0,portal_global_systemCode,true);
            $('#'+msgId).parentsUntil(".messager-body").parentsUntil(".panel window").window('close');
            msgRead(msgId,woCodeTaskId);
        }else if(msgId == 'all'){
            openTabCrossDomainIcsSimple("message_notice",tabName,tabUrl+'?totalMsgflag=1',true,0,portal_global_systemCode,true);
            $('#totalDialog').dialog('close');
        }
    }

    /**
     * 更新已读消息
     * */
    function msgRead(msgId,woCode){
        uceAjax('/ics-remind/cs/CsTaskMsg/updateMsgRead/'+woCode+'.do',{},function (result) {
            if(result.success){
                $('#'+msgId).parent("div.messager-body").window("close");
            }
        });
    }

    // 弹出消息统计框
    function showTotalDialog(){
        var dialogWidth = 250;		// dialog的宽度
        var dialogHeight = 200;		// dialog的高度
        var topPosition = $(window).height() - dialogHeight;
        var leftPosition = $(window).width() - dialogWidth;
        $('#totalDialog').dialog({
            width: dialogWidth,
            height: dialogHeight,
            top : topPosition -150,
            left : leftPosition-5,
            right:5,
            title:'<div style="font-size:15px;font-weight:bold;margin-top:0;color:#7747ab;">消息统计</div>'
        }).dialog('open');
        $('#totalDialog').parents('.panel').css('right','5px');
        //$('#totalDialog').parents('.panel').css('bottom','150px');
        $('#totalDialog').parents('.panel').css('border-radius','4px');
    }
    //弹出未读数据
    function openUnReadMsgdlg(){
        showTotalDialog();
    }
    //未读数据
    function totalMsg(type){
        uceAjax('/ics-remind/cs/CsMsg/findCountCurrentMsg.do',{},function (result) {
            if(result.success) {
                if(result.total >0 ){
                    showUnReadMsg();
                }else{
                    if(type == 'timeout'){
                        //不展示数据
                        return;
                    }else if(type == 'page'){
                        showInfoMsg("当前无未读数据");
                        return;
                    }
                }
            }
        },"POST");
    }

    function showUnReadMsg(){
        showTotalDialog();
    }

    /**
     * 消息总数
     * */
    function showMsgGrid(data){
        $("#totalDataGridMsg").datagrid("loadData",data);
        showTotalDialog();
    }



    /* 弹出普通消息 */
    function showMag(msg,msgId){
        var baseMsgId = msgId.split("_")[0] + "_"+ msgId.split("_")[1];
        var showOption={
            title:'<div style="font-size:15px;font-weight:bold;margin-top:0;color:#7747ab;">消息提醒</div>',
            msg:'',
            timeout: 0,
            showType:'show'
        }
        showOption.msg=
            '</div><div style="color:#777272;" class="msg_a" id="'+baseMsgId+'">' + msg + '</div>';
        document.getElementById("audio").play();
        var $msgMag = $.messager.show(showOption);
        $('.msg_a').parentsUntil('.panel window').css('height','auto');
        $('.msg_a').parentsUntil('.panel window').css('right','5px');
        $('.msg_a').parentsUntil('.panel window').css('bottom','28px');
        $('.msg_a').parentsUntil('.panel window').css('border-radius','4px');
        $msgMag.parent().find(".panel-tool-close").bind("click",function(){
            var woCode = msgId.split("_")[1] + "_"+ msgId.split("_")[2];
            msgRead(msgId,woCode);
        });
        setTimeout(function(){
            $msgMag.parent().find(".panel-tool-close").trigger("click");
        }, msgSingTimeout);
    }

    /**
     * 消息功能(右下角)
     * @param msg 消息内容
     * @param type 消息类型 success(成功)、error（错误）、warning（警告）、info（普通消息）
     * @param timeout 超时时间,默认3000毫秒(可选参数)
     */
    function showIcsTips(msg, type, timeout) {
        if (isEmptyObject(msg)) {
            return;
        }
        var	infoTitle = type=='success'?'成功':(type=='error'?'错误':(type=='warning'?'警告':'消息'));
        var infoDom = '<div style="font-size:15px;font-weight:bold;margin-top:0;color:#464c5b;">'+infoTitle+'</div><div style="margin-top:5px;color:#777272;">' + msg + '</div><div id="uce-msg" class="panel-tool" style="top:15px;right:5px;color: #657180;"><a class="panel-tool-close" ></a></div>';
        var msg;
        if(type=='success'){
            msg = '<div class="messager-icon messager-success"></div>'+infoDom;
        }else if(type=='error'){
            msg = '<div class="messager-icon messager-error"></div>'+infoDom;
        }else if(type=='warning'){
            msg = '<div class="messager-icon messager-warning"></div>'+infoDom;
        }else{
            msg = '<div class="messager-icon messager-info" ></div>'+infoDom;
        }
        var infoTimeout = !timeout ? 3000 : timeout;
        var msgtip = $.messager.show({
            msg: msg,
            timeout: infoTimeout,
            showType: 'fade',
            height:'83'
        });
        $('.messager-body').parents('.panel').css('right','5px');
        $('.messager-body').parents('.panel').css('bottom','100px');
        $('.messager-body').parents('.panel').css('border-radius','4px');
        $('#uce-msg').bind('click',function(){
            msgtip.window('close');
        })
    }
    /**
     * confirm
     * @param msg 消息内容
     * @param fn 回调方法
     * @param args 回调方法参数
     * @param closable:true 去掉右上角X
     */
    function confirmMsg(msg, fnY,fnN, args, title,closable) {
        var	infoTitle = !title ? '确认操作' : title;
        var msg = "<p>"+msg+"</p>";
        $.messager.confirm(infoTitle, msg, function(r) {
            if (r) {
                fnY.apply(this, args);
            }else{
                fnN.apply(this, args);
            }
        });
        if(closable){
            $(".panel-tool-close").css("display","none");
        }

    }
    /**
     * alert info消息功能
     * @param msg 消息内容
     * @param fn 回调方法(可选参数)
     * @param args 回调方法参数(可选参数)
     * @param title 消息标题(可选参数)
     */
    function showInfoMsg(msg, fn ,args, title) {
        if (isEmptyObject(msg)) {
            return;
        }
        var	infoTitle = !title ? '信息提示' : title;
        var msg = "<p>"+msg+"</p>";
        if (!fn) {
            $.messager.alert(infoTitle, msg, 'info');
            return;
        }
        $.messager.alert(infoTitle, msg, 'info', function(){
            fn.apply(this, args);
        });
    }

</script>
</body>
</html>
